package com.cx.base.day17_proxy.cglib;

import lombok.extern.slf4j.Slf4j;

import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;

/**
 * @author shkstart
 * @date 8/6/2019 - 3:47 PM
 */
@Slf4j
public class CglibTest {
    //为了实现商品的业务操作和日期操作-------->增强实现
    public static void main(String[] args) throws UnsupportedEncodingException {

        log.debug(String.valueOf((int) java.lang.Math.round(-19.8d)));

        ProductService productServiceOrigin = new ProductService();
        ProductService productService = (ProductService) new MyCglibProxy(productServiceOrigin).getProxyInstance();
        productService.add(new Product());
        productService.delete(new Product());
        System.out.println(productService instanceof Service);
//        System.out.println(productService.i);
//        System.out.println("目标类："+productServiceOrigin.product);
//        System.out.println("代理类："+productService.product);
        System.out.println(System.getProperty("file.encoding"));
        try {
            Thread.sleep(10000000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

